<?php
require_once "common.php";
class sort{
	private $array;
	//构造函数初始化
	function __construct($array){
		if(is_array($array)){
			$this->array=$array;
		}
	}
	//排序函数
	private function sort(){
		for($i=0;$i<count($this->array);$i++){
			for($j=count($this->array)-1;$j>$i;$j--){
				if($this->array[$j][weight]<$this->array[$j-1][weight]){
					$temp=$this->array[$j];
					$this->array[$j]=$this->array[$j-1];
					$this->array[$j-1]=$temp;
					}
			}
		}
		return $this->array;
	}
	public function output(){
		$result=$this->sort();
		return $result;
	}
}
//测试
//$array=array();
//for($i=0;$i<10;$i++){
//	$array[$i]=rand(0,10);
//}
//	echo "排序前：";
//	print_r($array);
//$sort=new sort($array);
//$result=$sort->output();
//echo "<br />";
//echo "排序后：	";
//print_r($result);

?>
